-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add refute statement #776
Add refute statement #776
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the structure is mostly ok, but please check my comments. This PR is missing tests though. Please add a few to folder src/test/resources/regressions/features/refute
(which needs to be created). We usually write multiple types of tests:
- type-checking tests, e.g., what happens when we write
refute 1
? Does Gobra provide an error in the correct line? - successful verification tests, i.e., tests that use the feature and should succeed.
- failed verification tests - these should indicate what is the expected verification error.
To annotate the expected type errors and verification errors, we use an annotation system that is exemplified in https://github.com/viperproject/gobra/tree/master/src/test/resources/regressions/features/opaque. Essentially, we use //:: ExpectedOutput(type_error)
in the line before the expected type error and //:: ExpectedOutput(error:cause)
before the line where a verification error is expected, where error
and cause
are replaced by the ids of the error kind and cause that you added
src/main/scala/viper/gobra/translator/transformers/RefuteTransformer.scala
Outdated
Show resolved
Hide resolved
src/main/scala/viper/gobra/translator/transformers/RefuteTransformer.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: João Pereira <joaopereira.19@gmail.com>
Co-authored-by: João Pereira <joaopereira.19@gmail.com>
Co-authored-by: João Pereira <joaopereira.19@gmail.com>
Co-authored-by: João Pereira <joaopereira.19@gmail.com>
267d035
to
bca538c
Compare
bca538c
to
4ed5c4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I just have a few small nitpicks, please address them before merging. Please use the option "Squash and merge" when merging this in master (on the Github CLI).
For future reference, this PR has more cool things besides refute
:
- It refactors Gobra to use the
FrontendAPI
, which besides other things, gives us pretty-printed Viper code that is easier to read e.g., it shows the code prior to applying the termination plugin. (This has the side effect of pretty-printing ill-formed Viper code due to a bug in silver where decreases clauses are printed asrequires decreases ...
, but that is a bug that we need to fix in silver anyway) - It fixes the error reporting in verification errors related to closures
- It deprecates part of the
TerminationTransformer
(we might be able to drop this entirely in the future)
src/main/scala/viper/gobra/translator/encodings/closures/MethodObjectEncoder.scala
Show resolved
Hide resolved
src/main/scala/viper/gobra/translator/encodings/closures/ClosureSpecsEncoder.scala
Show resolved
Hide resolved
src/main/scala/viper/gobra/translator/encodings/closures/ClosureSpecsEncoder.scala
Show resolved
Hide resolved
src/main/scala/viper/gobra/translator/transformers/TerminationDomainTransformer.scala
Outdated
Show resolved
Hide resolved
src/test/resources/regressions/features/refute/refute-fail-02.gobra
Outdated
Show resolved
Hide resolved
src/test/resources/regressions/features/refute/refute-fail-02.gobra
Outdated
Show resolved
Hide resolved
src/test/resources/regressions/features/refute/refute-fail-01.gobra
Outdated
Show resolved
Hide resolved
Co-authored-by: João Pereira <joaopereira.19@gmail.com>
Co-authored-by: João Pereira <joaopereira.19@gmail.com>
Co-authored-by: João Pereira <joaopereira.19@gmail.com>
This reverts commit aee8e53.
This PR adds support for
refute
statements.